/*
 * Idioma.java
 *
 * Created on 20 de noviembre de 2008, 13:57
 */
package Vistas;

import java.io.*;
import Dominio.*;
import javax.swing.JOptionPane;

/**Autor:Pedro Redondo Quesada 46471662-R**/
public class Idioma extends javax.swing.JFrame {

    CtrlDominio CD = CtrlDominio.getInstance();
    private String fs = System.getProperty("file.separator");

    /** Creates new form Idioma */
    public Idioma() {
        initComponents();
        BotonCatalan.setText("Catal\u00E1n");
        BotonIngles.setText("Ingl\u00E9s");
        this.setLocationRelativeTo(null);
        this.setTitle("Seleccionar Idioma");
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        BotonCastellano = new javax.swing.JButton();
        BotonCatalan = new javax.swing.JButton();
        BotonIngles = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        BotonCastellano.setText("Castellano");
        BotonCastellano.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                BotonCastellanoMouseClicked(evt);
            }
        });
        BotonCastellano.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonCastellanoActionPerformed(evt);
            }
        });

        BotonCatalan.setText("Catalán");
        BotonCatalan.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                BotonCatalanMouseClicked(evt);
            }
        });
        BotonCatalan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonCatalanActionPerformed(evt);
            }
        });

        BotonIngles.setText("Inglés");
        BotonIngles.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                BotonInglesMouseClicked(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        jLabel1.setForeground(new java.awt.Color(51, 0, 153));
        jLabel1.setText("ELIGE EL IDIOMA");

        jButton1.setText("Configurar idiomas");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(BotonCatalan, javax.swing.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(BotonCastellano, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(BotonIngles, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(28, 28, 28))))
            .addGroup(layout.createSequentialGroup()
                .addGap(105, 105, 105)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(98, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(40, 40, 40)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BotonCatalan)
                    .addComponent(BotonCastellano)
                    .addComponent(BotonIngles))
                .addGap(75, 75, 75)
                .addComponent(jButton1)
                .addContainerGap(69, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    private void BotonCatalanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonCatalanActionPerformed
        
}//GEN-LAST:event_BotonCatalanActionPerformed

    private void BotonCastellanoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonCastellanoActionPerformed
    // TODO add your handling code here:
}//GEN-LAST:event_BotonCastellanoActionPerformed

    private void BotonCatalanMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_BotonCatalanMouseClicked
        JOptionPane.showMessageDialog(this, "Cargando los diccionarios de Catalan... esta operaci\u00f3n puede tardar unos segundos", "La operaci\u00f3n puede tardar", JOptionPane.INFORMATION_MESSAGE);
        CD.cargarDiccionarios(System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DNcat.dicc", System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DPcat.dicc", System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DTcat.dicc", System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DNFcat.dicc");
        this.dispose();
        new menu(2).setVisible(true);
    }//GEN-LAST:event_BotonCatalanMouseClicked

    private void BotonCastellanoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_BotonCastellanoMouseClicked
        JOptionPane.showMessageDialog(this, "Cargando los diccionarios de Espa\u00f1ol... esta operaci\u00f3n puede tardar unos segundos", "La operaci\u00f3n puede tardar", JOptionPane.INFORMATION_MESSAGE);
System.out.println(System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DNesp.dicc");
        CD.cargarDiccionarios(System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DNesp.dicc", System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DPesp.dicc", System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DTesp.dicc", System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DNFesp.dicc");
        this.dispose();
        new menu(1).setVisible(true);
    }//GEN-LAST:event_BotonCastellanoMouseClicked

    private void BotonInglesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_BotonInglesMouseClicked
        JOptionPane.showMessageDialog(this, "Cargando los diccionarios de Ingles... esta operaci\u00f3n puede tardar unos segundos", "La operaci\u00f3n puede tardar", JOptionPane.INFORMATION_MESSAGE);
        CD.cargarDiccionarios(System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DNing.dicc", System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DPing.dicc", System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DTing.dicc", System.getProperty("user.dir") + fs + "src" + fs + "Diccionarios" + fs + "DNFing.dicc");
        this.dispose();
        new menu(3).setVisible(true);
    }//GEN-LAST:event_BotonInglesMouseClicked

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
        this.dispose();
        new ConfIdioma().setVisible(true);
    }//GEN-LAST:event_jButton1MouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Idioma().setVisible(true);
            }
        });
    }
    /*private void cargarIdioma(String pTH){
    try{
    int iterbar=0;
    ProgresBar B;
    DiccionarioPalabras DP=new DiccionarioPalabras();
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    DP.crearDiccionarioVacio();
    String fi = pTH;
    File f = new File(fi);
    BufferedReader entrada = new BufferedReader(new FileReader(f));
    int q = Integer.parseInt(entrada.readLine());
    B=new ProgresBar(q,"Cargando Diccionario");
    PalabraParaAnadir[] x = new PalabraParaAnadir[q];
    String pal;
    B.setVisible(true);
    for (int i = 0; i < q; i++) {
    pal = entrada.readLine();
    x[i]= new PalabraParaAnadir(pal);
    if ((DP.existLetra(x[i].getValor().charAt(0))) && DP.addPalabra(x[i])) {
    }
    iterbar++;
    if(iterbar%10==0){
    B.current.setValue(iterbar);
    Thread.sleep(10);
    }
    }
    B.setVisible(false);
    }
    catch(Exception e){}
    }*/
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotonCastellano;
    private javax.swing.JButton BotonCatalan;
    private javax.swing.JButton BotonIngles;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables
}
